<?php
/*
+--------------------------------------------------------------------------
|   AffiliStore 2
|   ========================================
|   Web: http://www.affilistore.com
|   Email: admin (at) affilistore (dot) com
|	License Type: AffiliStore 2 is NOT open source software and limitations apply 
|   Licence Info: Visit AffiliStore website and click on 'Licence'
+--------------------------------------------------------------------------
*/
if (eregi(".inc.php",$HTTP_SERVER_VARS['PHP_SELF']) || eregi(".inc.php",$_SERVER['PHP_SELF'])) {
	echo "<html>\r\n<head>\r\n<title>Forbidden 403</title>\r\n</head>\r\n<body><h3>Forbidden 403</h3>\r\nThe document you are requesting is forbidden.\r\n</body>\r\n</html>";
	exit;
}



// page listing
$getPageLinksTop = mysql_query("SELECT * FROM affiliSt_pages WHERE parent = '0' ORDER BY name ASC");
$pageLinksTop = mysql_fetch_assoc($getPageLinksTop);

// subpage listing
$sql = sprintf("SELECT * FROM affiliSt_pages WHERE parent = %s ORDER BY name ASC",
				quote_smart($_GET['page']));
$getPageLinksSub = mysql_query($sql, $databaseConnect) or die(mysql_error());
$pageLinksSub = mysql_fetch_assoc($getPageLinksSub);
$storedCategory = '';

$box_content = new XTemplate ("skins/".$configSkin['value']."/styleTemplates/pagelinks.tpl");



// create navigation from category and brond list
do { 
	if ($pageLinksTop['id'] != 1) {
	$catresult = $pageLinksTop['id'];
	// get link location options
	$linkOpt = explode(":", $pageLinksTop['location']);
		if ($linkOpt[1] == 1) {
			if ($storedCategory != $catresult) {
			
				if ($catresult == $_GET['page']) {
				$box_content->assign("FONTSTYLE",'catNavOn');
				} else {
				$box_content->assign("FONTSTYLE",'catNavOff');
				}
				
				if ($navOpt[7] == 1) {
				// html perma
				$box_content->assign("LINKDATA",$installDir['value'].'page/'.$catresult.'/'.urltxt($pageLinksTop['name']).'.html');
				} else {
				// php link
				$box_content->assign("LINKDATA",$installDir['value'].'index.php?case=page&page='.$catresult);
				}
				
			$box_content->assign("DATA",$pageLinksTop['name']);
				
				
				
			// start sub nav
				if ($catresult == $_GET['page'] && $pageLinksSub['id'] != NULL) {
				
				$box_content->assign("OPENUL","<ul>");
				$box_content->parse("pagelinks.li.openul");
						
					do {
					$theresult = $pageLinksSub['id'];
						if ($storedBrand != $theresult) {
							if ($theresult == $_GET['subpage']) {
							$box_content->assign("SUBFONTSTYLE",'brandNavOn');
							} else {
							$box_content->assign("SUBFONTSTYLE",'brandNavOff');
							}
						if ($navOpt[7] == 1) {
						// html perma
						$box_content->assign("SUBLINKDATA",$installDir['value'].'subpage/'.$catresult.'/'.$theresult.'/'.urltxt($pageLinksSub['name']).'.html');
						} else {
						// php link
						$box_content->assign("SUBLINKDATA",$installDir['value'].'index.php?case=subpage&page='.$catresult.'&subpage='.$theresult);
						}
						
					$box_content->assign("SUBDATA",$pageLinksSub['name']);
					$box_content->parse("pagelinks.li.subli");
					$storedBrand = $theresult;
					} else {
					$theresult = $pageLinksSub['id'];
					}
				
		
				} while ($pageLinksSub = mysql_fetch_assoc($getPageLinksSub));
				
				$box_content->assign("CLOSEUL","</ul>");
				$box_content->parse("pagelinks.li.closeul");
			}
			// end sub nav
				
				
		$box_content->parse("pagelinks.li");
		
		$storedCategory = $catresult;
		} else {
		$catresult = ucwords(strtolower($pageLinksTop['id']));
		}
	}
	}
} while ($pageLinksTop = mysql_fetch_assoc($getPageLinksTop)); 



			
$box_content->assign("TITLE","Pages");
$box_content->assign("SKIN",$configSkin['value']);
$box_content->parse("pagelinks");
$box_content = $box_content->text("pagelinks");
?>